#include "classifierprteditor.h"
#include "ui_classifierprteditor.h"
#include "rangeedititem.h"
#include <QDebug>

ClassifierPrtEditor::ClassifierPrtEditor(const QString& name,QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ClassifierPrtEditor)
{
    ui->setupUi(this);
    ui->classifierPrtName->setText(name);
    QGridLayout* glayout = new QGridLayout(this);
    for(int i =0;i<12;i++)
    {qDebug()<<i;
        RangeEditItem* item = new RangeEditItem(QString("R%1").arg(i+1),this);
        item->setObjectName(QString("R%1").arg(i));
        glayout->addWidget(item,i/4,i%4,1,1);
    }
    ui->widget_range->setLayout(glayout);
}

ClassifierPrtEditor::~ClassifierPrtEditor()
{
    delete ui;
}

void ClassifierPrtEditor::setRangeHiLo(int range, float h, float l)
{
    RangeEditItem* item = this->findChild<RangeEditItem*>(QString("R%1").arg(range));
    item->setHi(h);
    item->setLo(l);
}
